//
//  Stock.swift
//  TertiumQuidPattern
//
//  Created by mac on 2017/11/2.
//  Copyright © 2017年 RRC. All rights reserved.
//

import Foundation

//库存管理类
public class Stock:AbstractColleague{
    /////修改
    override init(mediator: AbstractMediator) {
        super.init(mediator: mediator)
    }
    
    //刚开始有100台电脑
    private  var COMPUTER_NUMBER:Int = 100
    
    ///库存增加
    func increase(number:Int){
        COMPUTER_NUMBER = COMPUTER_NUMBER + number
        print("库存数量为：\(COMPUTER_NUMBER)")
    }
    
    ///库存降低
    func decrease(number:Int){
        COMPUTER_NUMBER = COMPUTER_NUMBER - number
        print("库存数量为：\(COMPUTER_NUMBER)")
    }
    
    ///获得库存数量
    func getStockNumber() -> Int {
        
        return COMPUTER_NUMBER
    }
    
    ///存贷压力在了，就要能知采购人员不要采购，销售人员要尽快销售
    func clearSock(){
//        let purchase = Purchase()
//        let sale = Sale()
//        print("清理存贷数量为：\(Stock.COMPUTER_NUMBER)")
//        //要求折价销售
//        sale.offSale()
//        //要求采购人员不要采购
//        purchase.refuseBuyIBM()
        
        /////修改
        print("清理存贷数量为\(COMPUTER_NUMBER)")
        super.mediator.execute(str: "stock.clear")
        
    }
    
    
    
}
